home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d3 / rettig.arc / TRSOURCE.EXE / _TR_ERRS.C < prev    next >
C/C++ Source or Header  |  1990-10-22  |  1KB  |  41 lines

  1. /*********
  2. *  Function: _tr_errmsgs 
  3. *
  4. *  By: Tom Rettig
  5. *
  6. * Placed in the public domain by Tom Rettig Associates, 10/22/1990.
  7. *
  8. *   char *_tr_errmsgs( (char*)calling function name, (int)message index )
  9. *
  10. *   runtime error messages for functions returning <expC>
  11. *
  12. *   calling function must pass its own name
  13. *
  14. *********/
  15.  
  16. #include "trlib.h"
  17.  
  18. char *_tr_errmsgs( funcname, message )
  19. char *funcname;
  20. int message;
  21. {
  22.    static char *errmsg[] =
  23.                  { "TRLIB ERROR: ",     /* prefix to all other errors */
  24.                    " SYNTAX",
  25.                    " ALLOCATING MEMORY",
  26.                    " OPENING FILE",
  27.                    " SEEKING FILE POSITION",
  28.                    " READING FILE",
  29.                    " WRITING FILE",
  30.                    " CLOSING FILE"
  31.                  };
  32.    static char tempbuff[64] = " "; /* max error msg len is 63 including funcname */
  33.    char *tp;
  34.  
  35.    tp = tempbuff;
  36.    tp = _tr_strcpy( tp, errmsg[E_PREFIX] );
  37.    tp = _tr_strcat( tp, funcname );
  38.    return( _tr_strcat(tp,errmsg[message]) );
  39. }
  40.  
  41.